import { Transform } from 'jscodeshift'

/**
 * Codemod to eject the `deprecatedDefaultTheme` object no longer provided in v7
 * ```
 * npx jscodeshift -t node_modules/evergreen-ui/codemods/dist/6.0.0-7.0.0/eject-deprecated-default-theme.js --parser=tsx --extensions=js,jsx,ts,tsx fileOrDirectory --dry --print
 * ```
 *
 * This codemod will vendorize a file with the entire `deprecatedDefaultTheme` object from Evergreen v6.
 * Make sure you're providing an empty file or a file that you expect to be fully overwritten.
 */

const deprecatedDefaultTheme = {
  scales: {
    neutral: {
      N1: '#F9F9FB',
      N2: '#F5F6F7',
      N3: '#EDF0F2',
      N4: '#E4E7EB',
      N5: '#C7CED4',
      N6: '#A6B1BB',
      N7: '#7B8B9A',
      N8: '#66788A',
      N9: '#425A70',
      N10: '#234361',
      N1A: 'rgba(67, 90, 111, 0.04)',
      N2A: 'rgba(67, 90, 111, 0.06)',
      N3A: 'rgba(67, 90, 111, 0.09)',
      N4A: 'rgba(67, 90, 111, 0.14)',
      N5A: 'rgba(67, 90, 111, 0.3)',
      N6A: 'rgba(67, 90, 111, 0.47)',
      N7A: 'rgba(67, 90, 111, 0.7)',
      N8A: 'rgba(67, 90, 111, 0.81)'
    },
    blue: {
      B1: '#f7f9fd',
      B2: '#f1f7fc',
      B3: '#e9f2fa',
      B4: '#ddebf7',
      B5: '#b7d4ef',
      B6: '#8fbce6',
      B7: '#579ad9',
      B8: '#3d8bd4',
      B9: '#1070ca',
      B10: '#084b8a',
      B1A: 'rgba(16, 112, 202, 0.04)',
      B2A: 'rgba(16, 112, 202, 0.06)',
      B3A: 'rgba(16, 112, 202, 0.09)',
      B4A: 'rgba(16, 112, 202, 0.14)',
      B5A: 'rgba(16, 112, 202, 0.3)',
      B6A: 'rgba(16, 112, 202, 0.47)',
      B7A: 'rgba(16, 112, 202, 0.7)',
      B8A: 'rgba(16, 112, 202, 0.81)'
    }
  },
  fills: {
    solid: {
      neutral: {
        color: 'white',
        backgroundColor: '#425A70'
      },
      blue: {
        color: 'white',
        backgroundColor: '#1070ca'
      },
      red: {
        color: 'white',
        backgroundColor: '#ec4c47'
      },
      orange: {
        color: 'white',
        backgroundColor: '#d9822b'
      },
      yellow: {
        color: '#7e6514',
        backgroundColor: '#f7d154'
      },
      green: {
        color: 'white',
        backgroundColor: '#47b881'
      },
      teal: {
        color: 'white',
        backgroundColor: '#14b5d0'
      },
      purple: {
        color: 'white',
        backgroundColor: '#735dd0'
      }
    },
    subtle: {
      neutral: {
        color: '#425A70',
        backgroundColor: '#E4E7EB'
      },
      blue: {
        color: '#084b8a',
        backgroundColor: '#ddebf7'
      },
      red: {
        color: '#bf0e08',
        backgroundColor: '#fae2e2'
      },
      orange: {
        color: '#95591e',
        backgroundColor: '#fae3cd'
      },
      yellow: {
        color: '#7e6514',
        backgroundColor: '#fbe6a2'
      },
      green: {
        color: '#00783e',
        backgroundColor: '#d4eee2'
      },
      teal: {
        color: '#007489',
        backgroundColor: '#d2eef3'
      },
      purple: {
        color: '#37248f',
        backgroundColor: '#eae7f8'
      }
    },
    options: ['neutral', 'blue', 'red', 'orange', 'yellow', 'green', 'teal', 'purple']
  },
  colors: {
    background: {
      tint1: '#F9F9FB',
      tint2: '#F5F6F7',
      overlay: 'rgba(67, 90, 111, 0.7)',
      yellowTint: '#fef8e7',
      greenTint: '#f1faf5',
      orangeTint: '#fdf8f3',
      redTint: '#fef6f6',
      blueTint: '#f7f9fd',
      purpleTint: '#f8f7fc',
      tealTint: '#f1fbfc'
    },
    text: {
      muted: '#66788A',
      default: '#425A70',
      dark: '#234361',
      selected: '#1070ca',
      success: '#00783e',
      info: '#084b8a',
      danger: '#bf0e08',
      warning: '#95591e'
    },
    icon: {
      default: '#66788A',
      muted: '#7B8B9A',
      disabled: 'rgba(67, 90, 111, 0.3)',
      selected: '#1070ca',
      success: '#47b881',
      info: '#1070ca',
      danger: '#ec4c47',
      warning: '#d9822b'
    },
    intent: {
      none: '#1070ca',
      success: '#47b881',
      danger: '#ec4c47',
      warning: '#d9822b'
    }
  },
  palette: {
    neutral: {
      lightest: '#F9F9FB',
      light: '#E4E7EB',
      base: '#425A70',
      dark: '#234361'
    },
    blue: {
      lightest: '#f7f9fd',
      light: '#ddebf7',
      base: '#1070ca',
      dark: '#084b8a'
    },
    red: {
      lightest: '#fef6f6',
      light: '#fae2e2',
      base: '#ec4c47',
      dark: '#bf0e08'
    },
    orange: {
      lightest: '#fdf8f3',
      light: '#fae3cd',
      base: '#d9822b',
      dark: '#95591e'
    },
    yellow: {
      lightest: '#fef8e7',
      light: '#fbe6a2',
      base: '#f7d154',
      dark: '#7e6514'
    },
    green: {
      lightest: '#f1faf5',
      light: '#d4eee2',
      base: '#47b881',
      dark: '#00783e'
    },
    teal: {
      lightest: '#f1fbfc',
      light: '#d2eef3',
      base: '#14b5d0',
      dark: '#007489'
    },
    purple: {
      lightest: '#f8f7fc',
      light: '#eae7f8',
      base: '#735dd0',
      dark: '#37248f'
    }
  },
  typography: {
    fontFamilies: {
      display:
        '"SF UI Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
      ui:
        '"SF UI Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
      mono: '"SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace'
    },
    headings: {
      '100': {
        fontSize: '11px',
        fontWeight: 400,
        textTransform: 'uppercase',
        lineHeight: '16px',
        letterSpacing: '0.6px',
        marginTop: 16,
        fontFamily:
          '"SF UI Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#66788A'
      },
      '200': {
        fontSize: '12px',
        fontWeight: 600,
        lineHeight: '16px',
        letterSpacing: '0',
        marginTop: 16,
        fontFamily:
          '"SF UI Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#66788A'
      },
      '300': {
        fontSize: '12px',
        fontWeight: 600,
        lineHeight: '16px',
        letterSpacing: '0',
        marginTop: 16,
        fontFamily:
          '"SF UI Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#234361'
      },
      '400': {
        fontSize: '14px',
        fontWeight: 600,
        lineHeight: '20px',
        letterSpacing: '-0.05px',
        marginTop: 16,
        fontFamily:
          '"SF UI Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#234361'
      },
      '500': {
        fontSize: '16px',
        fontWeight: 500,
        lineHeight: '20px',
        letterSpacing: '-0.05px',
        marginTop: 24,
        fontFamily:
          '"SF UI Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#234361'
      },
      '600': {
        fontSize: '20px',
        fontWeight: 500,
        lineHeight: '24px',
        letterSpacing: '-0.07px',
        marginTop: 28,
        fontFamily:
          '"SF UI Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#234361'
      },
      '700': {
        fontSize: '24px',
        fontWeight: 500,
        lineHeight: '28px',
        letterSpacing: '-0.07px',
        marginTop: 40,
        fontFamily:
          '"SF UI Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#234361'
      },
      '800': {
        fontSize: '29px',
        fontWeight: 500,
        lineHeight: '32px',
        letterSpacing: '-0.2px',
        marginTop: 40,
        fontFamily:
          '"SF UI Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#234361'
      },
      '900': {
        fontSize: '35px',
        fontWeight: 500,
        lineHeight: '40px',
        letterSpacing: '-0.2px',
        marginTop: 52,
        fontFamily:
          '"SF UI Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
        color: '#234361'
      }
    },
    text: {
      '300': {
        fontSize: '12px',
        fontWeight: 400,
        lineHeight: '16px',
        letterSpacing: '0',
        marginTop: 12
      },
      '400': {
        fontSize: '14px',
        fontWeight: 400,
        lineHeight: '20px',
        letterSpacing: '-0.05px',
        marginTop: 12
      },
      '500': {
        fontSize: '16px',
        fontWeight: 400,
        lineHeight: '20px',
        letterSpacing: '-0.05px',
        marginTop: 16
      },
      '600': {
        fontSize: '20px',
        fontWeight: 400,
        lineHeight: '24px',
        letterSpacing: '-0.07px',
        marginTop: 28,
        fontFamily:
          '"SF UI Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
      }
    },
    paragraph: {
      '300': {
        fontSize: '12px',
        fontWeight: 400,
        lineHeight: '18px',
        letterSpacing: '0',
        marginTop: 12
      },
      '400': {
        fontSize: '14px',
        fontWeight: 400,
        lineHeight: '21px',
        letterSpacing: '-0.05px',
        marginTop: 12
      },
      '500': {
        fontSize: '16px',
        fontWeight: 400,
        lineHeight: '24px',
        letterSpacing: '-0.05px',
        marginTop: 16
      }
    }
  }
}

const transformer: Transform = (_file, _api) => {
  return `export const deprecatedDefaultTheme = ${JSON.stringify(deprecatedDefaultTheme, undefined, 4)}`
}

export default transformer
